package com.wing.cabinet.model.request;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.wing.cabinet.model.entity.CellInventoryInoutDetail;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 售刀柜上货(上货主表无展示)/领取明细Form
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class CellInventoryInoutDetailForm {

    /**
     * ID
     */
    private Long id;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 上货/领取id
     */
    private Long inoutId;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * 数量
     */
    private Integer quantity;

    /**
     * 企业id
     */
    private Long companyId;

    /**
     * 货道id
     */
    private Long spaceId;

    /**
     * 操作类型
     */
    private CellInventoryInoutDetail.Type type;

    /**
     * 货道
     */
    private String spaceCode;

    /**
     * sku code
     */
    private String skuCode;

    /**
     * 柜子编码
     */
    private String cabCode;


    public interface Add{}

    public interface Update{}

    /**
     * 当前库存
     */
    private Integer quantityCurrent;

    /**
     * 变动后库存
     */
    private Integer quantityAfter;


    /**
     * 配送单明细id
     */
    private Long detailId;

    private Long receiveDetailId;

    private String labelCode;

    private BigDecimal marketPrice;

    private Long workOrderId;

    private Long requestProductId;

    /**
     * 企业编码
     */
    private String enterpriseCode;

    private Integer useTime;

    private BigDecimal price;

    private BigDecimal total;

    private Long processId;

    private Long categoryId;

    private Long storageInventoryInoutDetailId;

    private Integer quantitySingleCabCurrent;

    private Integer quantitySingleCabAfter;

    private Integer quantityCabCurrent;

    private Integer quantityCabAfter;


    public enum CabType implements IEnum<Integer> {

        /**
         * 暂存
         */
        saleCab(1,"售刀柜"),
        /**
         * 维修
         */
        tempCab(2,"暂存柜");

        private int code;
        private String desc;

        CabType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static CabType jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (CabType item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    private CabType cabType;


    private Integer settingTime;


    private Integer remainingTime;



    /**
     * 寿命单位  1：小时/ 2：次数
     */
    private CellInventoryInoutDetail.LifeUnit lifeUnit;

    private Integer quantityPack;

    private Integer quantityPackUnit;

    private String mainCabCode;


    private Long packId;

    private String packName;



    private String unitName;

    private Integer quantityPackCurrent;

    private Integer quantityPackAfter;


    private Integer quantityPackSingleCabCurrent;

    private Integer quantityPackSingleCabAfter;


    private Integer quantityPackCabCurrent;

    private Integer quantityPackCabAfter;

    private String deviceCode;

}
